
#linux-igd_1.0.orig.tar.gz
#linux-igd-1.0.orig
Version:=1.0
ModuleName:=linux-igd

Object:=upnpd.tgz
Sub:=orig
ObjectDir:=$(ModuleName)-$(Version).$(Sub)
ObjectSource:=$(ModuleName)_$(Version).$(Sub).tar.gz

DependFiles:=
InstaEtcDir:=etc/linuxigd
InstaLibDir:=usr/lib
InstaSbinDir:=usr/sbin
PatchName:=linux-igd_1.0-1.diff

.PHONY: all clean dist_clean

null:

all:$(Object) 

# if make error, then we should to exec :cd /usr/lib/ && rm libupnp.so && ln -s libupnp.so.2.0.1 libupnp.so 
$(Object):$(ObjectSource)
	rm -rf $(InstaSbinDir) $(InstaLibDir) $(InstaEtcDir) && \
	mkdir -p $(InstaSbinDir) $(InstaLibDir) $(InstaEtcDir) && tar xzvf $(ObjectSource)
	patch -p 0 < $(PatchName) && make -C $(ObjectDir)
	cp -rf /usr/lib/libthreadutil.so.2 /usr/lib/libthreadutil.so.2.0.0 \
		/usr/lib/libupnp.so.2 /usr/lib/libixml.so.2 /usr/lib/libupnp.so.2.0.1 \
		/usr/lib/libixml.so.2.0.0 $(InstaLibDir)
	cp -rf $(ObjectDir)/upnpd $(InstaSbinDir)
	cp -rf $(ObjectDir)/etc/* $(InstaEtcDir)
	tar cvzf $(Object) usr etc

upnpsdk:upnpsdk-1.0.4.tar.gz
	tar xzvf upnpsdk-1.0.4.tar.gz ** cd upnpsdk-1.0.4 && make && make install	
upnplib:libupnp-1.3.1.tar.gz
	tar xzvf libupnp-1.3.1.tar.gz && cd libupnp-1.3.1 && ./configure --prefix=/usr && make && make install
clean:
	rm -rf $(Object) usr var etc

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjectSource) *.tar.gz upnpsdk-1.0.4  libupnp-1.3.1 
	
include ../Makefile.Res
